// export const baseUrl = "https://unitim.cn/api/"
const baseUrl = "http://127.0.0.1:8080/api/"
import { getstorage } from '@/miniprogram/utils/storage'
const urlPreFix = baseUrl
function httprequests(url, method, data, config) {
   const customerHeader = { ...config }
   let header = {}
   let s = getstorage('sessionToken')
   header = { 'content-type': 'application/json' }
   if (config != '' && s != '') {
      let content = `sessionToken=${s}`
      header['Cookie'] = content
   }
   return new Promise((resolve, reject) => {
      wx.showLoading({
         title: '数据加载中...',
      })
      wx.request({
         url: baseUrl + url,
         method,
         data,
         header: header,
         success: (res) => {
            resolve(res)
         },
         fail: (err) => {
            reject(err)
         },
      })
      wx.hideLoading()
   })
}
module.exports = {
   httprequests,
   urlPreFix
}
